<%@ include file="/WEB-INF/jsp/includes/include.jsp" %>
<%@ include file="/WEB-INF/jsp/includes/header.jsp" %>
<h2>Registered Users:</h2> 
<table cellspacing="0" cellpadding="5" border="1">
	<thead>
		<tr>
			<th>FIRST NAME</th>
			<th>LAST NAME</th>
			<th>USERNAME</th>
			<th>EMAIL CONTACT</th>
			<th>USER ROLE(S)</th>
			<th>LAST LOGIN</th>
			<th>EDIT</th>
		</tr>
	</thead>
	<tbody>
	<c:forEach var="user" items="${userList}" varStatus="rowCounter">
        <c:choose>
          <c:when test="${rowCounter.count % 2 == 0}">
            <c:set var="rowStyle" scope="page" value="row1"/>
          </c:when>
          <c:otherwise>
            <c:set var="rowStyle" scope="page" value="row2"/>
          </c:otherwise>
        </c:choose>
		<tr class="${rowStyle}">
			<td><c:out value="${user.firstName}" escapeXml="true" /></td>
			<td><c:out value="${user.lastName}" escapeXml="true" /></td>
			<td><c:out value="${user.username}" escapeXml="true" /></td>
			<td><c:out value="${user.emailAddress}" escapeXml="true" /></td>
			<td>
			<c:forEach var="role" items="${user.roles}">
				<c:out value="${role.name}" /><br />
		    </c:forEach>
			<c:if test="${user.requestSeller == 1}">
			<a href="<c:url value="/user/approve.html?id=${user.id}"/>">Approve for SELLER account</a>
			</c:if>
			</td>
			<td>${user.lastLoginAt}</td>
			<td><a href="<c:url value="/user/edit/${user.id}/"/>">edit</a></td>
		</tr>
	</c:forEach>
	</tbody>
</table>
<%@ include file="/WEB-INF/jsp/includes/footer.jsp" %>